{extend name="public/base" /}
{block name="main"}
<style>
    .nw{ width: 180px; float:left;}
</style>
<article>
    <form action="" method="post" class="form form-horizontal" id="form-admin-role-save" >
        <div class="modal-body">
            <table class="table table-border table-bg table-bordered">
                <thead>
                <tr>
                    <th width="20%">表单提示文字</th>
                    <td class="formControls">
                        <input type="text" class="input-text"  placeholder="发布内容时显示的提示文字" name="field_comment">
                    </td>
                </tr>
                </thead>
                <tbody>
                <tr class="active">
                    <th>字段名称</th>
                    <td class="formControls"><input type="text" class="input-text"  placeholder="数据表的真实字段名" name="field_name"></td>
                </tr>

                <tr class="success">
                    <th>字段类型</th>
                    <td class="formControls">
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype1" value="text" checked="1">单行文本(varchar)</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype2" value="textchar">单行文本(char)</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype3" value="multitext">多行文本</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype4" value="htmltext">HTML文本</div>
                        <br class="cls">
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype5" value="textdata">文本保存HTML数据</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype6" value="int">整数类型</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype7" value="float">小数类型</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype9" value="img">图片</div>
                        <br class="cls">
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype13" value="select">使用option下拉框</div>
                        <div class="nw"><input type="radio" class="np" name="dtype" id="dtype14" value="radio">使用radio选项卡</div>
                    </td>
                </tr>

                <tr class="warning">
                    <th>默认值</th>
                    <td>
                        <textarea name="vdefault" style="width: 100%; height: 100px;"></textarea>
                        <p>如果定义数据类型为select、radio、checkbox时，此处填写被选择的项目(用“,”分开，如“男,女,人妖”),其他为空。</p>
                    </td>
                </tr>
                </tbody>
            </table>

        </div>
        <div class="modal-footer">
            <input type="hidden" name="table_name" value="<?php echo $table_name?>">
            <button type="submit" class="btn btn-success radius" id="admin-role-save"><i class="icon-ok"></i> 确定</button>
        </div>
    </form>

</article>
{/block}
{block name="js"}
<script>
    $("#form-admin-role-save").validate({
        rules:{
            field_comment:{
                required:true,
            },
            field_name:{
                required:true,
                isEnglish:true,
            },
            dtype:{
                required:true,
            }
        },
        submitHandler:function(form){
            /**
             * 成功之后的回调函数
             * @type {{success: options.success}}
             */
            var options = {
                success: function (data) {
                    if(data.code==10000){
                        layer.msg(data.msg,{icon:1,time:1000});
                        setInterval("closeWindow()",1200);
                    }else{
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                }
            };
            $(form).ajaxSubmit(options);
        }
    });
    function closeWindow(){
        location.href ="<?php echo url('code/form',$get)?>";
    }
    </script>
{/block}